//
// * Copyright (c) 2002-2009 "Neo Technology,"
// *     Network Engine for Objects in Lund AB [http://neotechnology.com]
// *
// * This file is part of Neo4j.
// * 
// * Neo4j is free software: you can redistribute it and/or modify
// * it under the terms of the GNU Affero General Public License as
// * published by the Free Software Foundation, either version 3 of the
// * License, or (at your option) any later version.
// * 
// * This program is distributed in the hope that it will be useful,
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// * GNU Affero General Public License for more details.
// * 
// * You should have received a copy of the GNU Affero General Public License
// * along with this program. If not, see <http://www.gnu.org/licenses/>.
// 
namespace org.neo4j.kernel.impl.batchinsert
{


	using GraphDatabaseService = org.neo4j.graphdb.GraphDatabaseService;
	using RelationshipType = org.neo4j.graphdb.RelationshipType;

///
/// <summary> * The batch inserter drops support for transactions and concurrency in favor 
/// * of insertion speed. When done using the batch inserter <seealso cref="#shutdown()"/> 
/// * must be invoked and complete succesfully for the Neo4j store to be in 
/// * consistent state.  
/// * <p>
/// * Only one thread at a time may work against the batch inserter, multiple 
/// * threads peforming concurrent access has to be synchronized.
/// * <p>
/// * Transactions are not supported so if your JVM/machine crash or you fail to 
/// * invoke <seealso cref="#shutdown()"/> before JVM exits the Neo4j store can be considered 
/// * beeing in non consistent state and the insertion has to be re-done from 
/// * scratch. </summary>
/// 
	public interface BatchInserter
	{
///    
///     <summary> * Creates a node assigning next available id to id and also adds any 
///     * properties supplied.
///     *  </summary>
///     * <param name="properties"> a map containting properties or <code>null</code> if no 
///     * properties should be added.
///     *  </param>
///     * <returns> The id of the created node. </returns>
///     
		long createNode(Map<string, object> properties);

///    
///     <summary> * Checks if a node with the given id exists.
///     *  </summary>
///     * <param name="nodeId"> the id of the node. </param>
///     * <returns> <code>true</code> if the node exists. </returns>
///     
		bool nodeExists(long nodeId);

///    
///     <summary> * Sets the properties of a node. This method will remove any properties 
///     * already existing and replace it with properties in the supplied map.
///     * <p>
///     * For best performance try supply all the nodes properties upon creation 
///     * of the node. This method will delete any existing properties so using it 
///     * together with <seealso cref="#getNodeProperties(long)"/> will have bad performance.
///     *  </summary>
///     * <param name="node"> the id of the node. </param>
///     * <param name="properties"> map containing the properties or <code>null</code> to 
///     * clear all properties. </param>
///     
		void setNodeProperties(long node, Map<string, object> properties);

///    
///     <summary> * Returns a map containing all the properties of this node.
///     *  </summary>
///     * <param name="nodeId"> the id of the node.
///     *  </param>
///     * <returns> map contining this node's properties. </returns>
///     
		Map<string, object> getNodeProperties(long nodeId);

///    
///     <summary> * Returns an iterable over all the relationship ids connected to node with 
///     * supplied id. 
///     *  </summary>
///     * <param name="nodeId"> the id of the node. </param>
///     * <returns> and iterable over the relationship ids connected to the node. </returns>
///     
		IEnumerable <long> getRelationshipIds(long nodeId);

///    
///     <summary> * Returns an iterable of <seealso cref="SimpleRelationship relationships"/> connected
///     * to the node with supplied id.
///     *   </summary>
///     * <param name="nodeId"> the id of the node. </param>
///     * <returns> iterable over the relationships connected to the node. </returns>
///     
		IEnumerable <SimpleRelationship> getRelationships(long nodeId);

///    
///     <summary> * Creates a node with supplied id and properties. If a node with the given 
///     * id exist a runtime exception will be thrown.
///     *   </summary>
///     * <param name="id"> the id of the node to create. </param>
///     * <param name="properties"> map containting properties or <code>null</code> if no 
///     * properties should be added. </param>
///     
		void createNode(long id, Map<string, object> properties);

///    
///     <summary> * Creates a relationship between two nodes of a specific type. 
///     *  </summary>
///     * <param name="node1"> the start node. </param>
///     * <param name="node2"> the end node. </param>
///     * <param name="type"> relationship type.  </param>
///     * <param name="properties"> map containting properties or <code>null</code> if no 
///     * properties should be added. </param>
///     * <returns> the id of the created relationship. </returns>
///     
		long createRelationship(long node1, long node2, RelationshipType type, Map<string, object> properties);

///    
///     <summary> * Gets a relationship by id.
///     *  </summary>
///     * <param name="relId"> the relationship id. </param>
///     * <returns> a simple relationship wrapper for the relationship. </returns>
///     
		SimpleRelationship getRelationshipById(long relId);

///    
///     <summary> * Sets the properties of a relationship. This method will remove any 
///     * properties already existing and replace it with properties in the 
///     * supplied map.
///     * <p>
///     * For best performance try supply all the relationship properties upon 
///     * creation of the relationship. This method will delete any existing 
///     * properties so using it together with 
///     * <seealso cref="#getRelationshipProperties(long)"/> will have bad performance.
///     *  </summary>
///     * <param name="rel"> the id of the relationship. </param>
///     * <param name="properties"> map containing the properties or <code>null</code> to 
///     * clear all properties. </param>
///     
		void setRelationshipProperties(long rel, Map<string, object> properties);

///    
///     <summary> * Returns a map containing all the properties of the relationships.
///     *  </summary>
///     * <param name="relId"> the id of the relationship. </param>
///     * <returns> map contining the relationship's properties. </returns>
///     
		Map<string, object> getRelationshipProperties(long relId);

///    
///     <summary> * Shuts down this batch inserter syncing all changes that are still only 
///     * in memory to disk. Failing to invoke this method may leave the Neo4j 
///     * store in a inconsistent state.
///     * <p>
///     * After this method has been invoked any other method call to this batch 
///     * inserter is illegal. </summary>
///     
		void shutdown();

///    
///     <summary> * Returns the path to this Neo4j store.
///     *  </summary>
///     * <returns> the path to this Neo4j store. </returns>
///     
		string getStore();

///    
///     <summary> * Returns the reference node id or <code>-1</code> if it doesn't exist.
///     *  </summary>
///     * <returns> the reference node </returns>
///     
		long getReferenceNode();

///    
///     <summary> *  </summary>
///     * <returns> a GraphDatabaseService that does not support deletion and transactions </returns>
///     
		GraphDatabaseService getGraphDbService();
	}
}